Skip to content

Conversation

@kyzhangs
Copy link
Contributor

@kyzhangs kyzhangs commented Jun 5, 2025

No description provided.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jun 5, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jun 5, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

- label: MariaDB
value: mariadb
- label: PostgreSQL
value: postgresql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value: postgres

直接把 value 设为 postgres 就行,这样脚本里就不用再重新判断赋值了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个思路应该是driverName=$PANEL_DB_TYPE,但是如果选择 mariadb 时,仍然需要在 init.sh 脚本特殊处理下。
我会改为value: postgres,然后 init.sh 脚本改成如下,你看是否可以?

#!/bin/bash

[ -f ./.env ] && source ./.env

# Default configuration
CASDOOR_DRIVER_NAME=${PANEL_DB_TYPE}
CASDOOR_DATASOURCE_NAME="${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@tcp(${PANEL_DB_HOST}:${PANEL_DB_PORT})/"

# Reset mariadb driver
if [ "$PANEL_DB_TYPE" = "mariadb" ]; then
  CASDOOR_DRIVER_NAME="mysql"
fi

# Reset postgresql datasource
if [ "$PANEL_DB_TYPE" = "postgres" ]; then
  CASDOOR_DATASOURCE_NAME="user=${PANEL_DB_USER} password=${PANEL_DB_USER_PASSWORD} host=${PANEL_DB_HOST} port=${PANEL_DB_PORT} dbname=${PANEL_DB_NAME} sslmode=disable"
fi

{
  # Retain the original environment variables
  grep -vE '^(CASDOOR_DRIVER_NAME|CASDOOR_DATASOURCE_NAME)' ./.env 2>/dev/null

  # Add CASDOOR_xx environment variables
  echo "CASDOOR_DRIVER_NAME=\"${CASDOOR_DRIVER_NAME}\""
  echo "CASDOOR_DATASOURCE_NAME=\"${CASDOOR_DATASOURCE_NAME}\""
  echo ""
} > ./.env.tmp && mv ./.env.tmp ./.env

以上已在本地测试通过

# Construct the postgresql connection configuration
if [ "$PANEL_DB_TYPE" = "postgresql" ]; then
CASDOOR_DRIVER_NAME="postgres"
CASDOOR_DATASOURCE_NAME="user=${PANEL_DB_USER} password=${PANEL_DB_USER_PASSWORD} host=${PANEL_DB_HOST} port=${PANEL_DB_PORT} dbname=${PANEL_DB_NAME} sslmode=disable"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问这是官方提供的 datasource 吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对的,这是 casdoor 官方文档上的(如下图)。mysql 和 postgres 数据库的格式不同,postgres 使用 mysql 的格式程序会报错。
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本地环境测试没问题的话?再同步一下最新代码,应用版本有更新。

@wanghe-fit2cloud wanghe-fit2cloud merged commit a131765 into 1Panel-dev:dev Jun 8, 2025
1 of 2 checks passed
@kyzhangs kyzhangs deleted the casdoor branch June 9, 2025 01:04
pull bot pushed a commit to dreamoeu/appstore that referenced this pull request Dec 21, 2025
…ish-byte-muse-1.x

chore(deps): update envyafish/byte-muse docker tag to v1.26.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants